import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { CredentialsDto } from './dto/credentials.dto';
import { TokenDto } from './dto/token.dto';

@Injectable({
  providedIn: 'root',
})
export class TokensService {
  constructor(private http: HttpClient) {}

  /**
   * 创建一个令牌
   * @param credentialsDto 凭据
   */
  create(credentialsDto: CredentialsDto) {
    return this.http.post<TokenDto>('tokens', credentialsDto);
  }
}
